
const state = {
  List: [],
  fields: [], // fields
};


const actions = {
  GetFields({ commit }, data) {
    let fields = [
      {
        title: '序号',
        dataIndex: 'id',
        align: 'center',
        width: 200
      },
      {
        title: '排序',
        dataIndex: 'sort',
        align: 'center',
      },
      {
        title: '作者',
        dataIndex: 'author',
        align: 'center',
      },
      {
        title: '分类名称',
        dataIndex: 'type_name',
        align: 'center',
      },
      {
        title: '素材标题',
        dataIndex: 'title',
        align: 'center',
      },
      {
        title: '状态',
        dataIndex: 'is_pub',
        align: 'center',
      },
      {
        title: '创建时间',
        dataIndex: 'ctime',
        align: 'center',
      },
      {
        title: '操作',
        dataIndex: 'action',
        scopedSlots: { customRender: 'action' },
        align: 'center',
        width: 150,
      }
    ];
    commit('setfields', fields);
  },
};

const mutations = {
  // SetLists(state, lists) {
  //   state.List = lists;
  // },
  setfields(state, lists) {
    // console.log(state)
    state.fields = lists;
  },
  // SetTotal(state, lists) {
  //   // console.log(state)
  //   state.page.total = lists;
  // },
};

export default {
  namespaced: true,
  state,
  actions,
  mutations
};
